<?php
/**
 * @Author: speakphp
 * @Date:   2015-09-18 21:37:02
 * @Last Modified by:   Awe
 * @Last Modified time: 2015-09-18 21:41:37
 */


class InfoModel extends CommonModel {
    public function __construct(){
        parent::__construct();
        $this->nav_path = C("nav_cache_path");
    }
    function editpwd($newpwd , $repwd){
        if(empty($newpwd) || empty($repwd ) ){
            return array('status'=> 0 , 'message'=>'密码必须进行填写');
        }elseif($newpwd != $repwd ){
            return array('status'=> 0 , 'message'=>'2次密码不相同');
        }
        $pwd = md5($newpwd);
        $num = M("Admin_user")->where("id = ".$this->uid)->save(array('passwd'=>$pwd));
        $sql = M("Admin_user")->getLastSql();
        if($num >= 1 ){
            write_action_log($sql, getModuleAction(),$this->username,get_client_ip(),1,"用户{$this->username}修改密码成功");
            return array('status'=> 1 , 'message'=>'密码修改成功');
        }
        write_action_log($sql, getModuleAction(),$this->username,get_client_ip(),0,"用户{$this->username}修改密码失败");
            return array('status'=> 0 , 'message'=>'修改失败 你可能没有修改数据');
    }
    
}
